package com.jfinal_demo.app;

public class DataWrapper {
	private boolean succeed;
	private Object data;
	private String errorMessage;

	public DataWrapper() {
		succeed = true;
	}

	public static DataWrapper success(Object data) {
		DataWrapper wrapper = new DataWrapper();
		wrapper.data = data;
		return wrapper;
	}

	public static DataWrapper fail(String errorMessage) {
		DataWrapper wrapper = new DataWrapper();
		wrapper.succeed = false;
		wrapper.errorMessage = errorMessage;
		return wrapper;
	}

	public String getErrorMessage() {
		return errorMessage;
	}

	public Object getData() {
		return data;
	}

	public boolean isSucceed() {
		return succeed;
	}
}
